<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <script>
      window.onload = function () {
        //   // 扩展运算符可以将数组拆分成以逗号分隔的参数序列
        //   let ary = ["a", "b", "c"];
        //   console.log(...ary);
        //   console.log("a", "b", "c");

        // 扩展运算符应用于数组合并
        let ary1 = [1, 2, 3];
        let ary2 = [4, 5, 6];
        //   let ary3 = [...ary1, ...ary2];
        //   console.log(ary3);

        //   方法2
        ary1.push(...ary2);
        console.log(ary1);

        //   扩展运算符可以将伪数组转换为真正的数组
        var oDivs = document.getElementsByTagName("div");

        // var ary4 = [...oDivs];
        // console.log(ary4);

        // Array.from()方法
        let ary4 = Array.from(oDivs);
        console.log(ary4);
      };
    </script>
  </head>
  <body>
    <div></div>
    <div></div>
    <div></div>
    <div></div>
  </body>
</html>
